Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PKG -- [fcl] Default to localStorage #1782

Merged
merged 1 commit into from
Sep 28, 2023
Merged

Conversation

jribbink
Copy link
Contributor

closes #1776

@jribbink jribbink requested a review from a team as a code owner September 26, 2023 23:01
@changeset-bot
Copy link

changeset-bot bot commented Sep 26, 2023

🦋 Changeset detected

Latest commit: f114a72

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@onflow/fcl Minor
@onflow/fcl-wc Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jribbink jribbink changed the title Default to localStorage PKG -- [fcl] Default to localStorage Sep 27, 2023
Comment on lines -3 to -14
const getSessionStorage = () => {
try {
const SESSION_STORAGE = {
can: !isServerSide(),
get: async key => JSON.parse(sessionStorage.getItem(key)),
put: async (key, value) => sessionStorage.setItem(key, JSON.stringify(value)),
}
return SESSION_STORAGE
} catch (error) {
return null
}
}
Copy link
Contributor Author

@jribbink jribbink Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I scrapped the factory function here just because it feels simpler for the user to say fcl.storage.default=LOCAL_STORAGE than fcl.storage.default=getLocalStorage() for users. It seems like a bit of an unnecessary abstraction since the object returned is always the same & there's no errors that can occur in the try-catch block anyways.

Happy to reconsider if there's any objections to this however.

@jribbink jribbink merged commit 3d037e8 into master Sep 28, 2023
1 check passed
@jribbink jribbink deleted the jribbink/localstorage branch September 28, 2023 17:05
@github-actions github-actions bot mentioned this pull request Sep 28, 2023
nialexsan added a commit that referenced this pull request Oct 31, 2023
nialexsan added a commit that referenced this pull request Oct 31, 2023
nialexsan added a commit that referenced this pull request Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Default to local storage
2 participants